package homeworkplus.day02;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @Classname: Test08
 * @Author: bromide
 * @CreateTime: 2022/3/30--8:58
 * @Version: V1.0
 * @Desciption: 要求用户输入若干员工信息，格式为：
 * name,age,gender,salary;name,age,gender,salary;....
 * 例如:
 * 张三,25,男,5000;李四,26,女,6000;...
 * 然后将每个员工信息解析成Person对象。并存入到一个数组中。
 * 然后循环数组，输出每一个员工信息(输出使用toString返回的字符串)
 */
public class Test08 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String info = scanner.nextLine();
        String[] infos = info.split(";");
        Person[] persons = new Person[infos.length];
        for (int i = 0; i < infos.length; i++) {
            String[] property = infos[i].split(",");
            persons[i] = new Person(property[0], Integer.parseInt(property[1]), property[2], Integer.parseInt(property[3]));
        }
        for (int i = 0; i < persons.length; i++) {
            System.out.println(persons[i]);
        }
    }
}
